package com.web.service;

import com.web.entity.Product;
import com.web.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductMapper productMapper;

    public List<Product> findAll(){
        return this.productMapper.list();
    }

    public Product findById(Integer id){
        return this.productMapper.get(id);
    }

    public void save(Product product){
        this.productMapper.add(product);
    }

    public void delete(Integer id){
        this.productMapper.delete(id);
    }


    public void update(Product product){
        this.productMapper.update(product);
    }



}
